using System;
using LS.Entity;
using UnityEngine;
using Unity.VisualScripting;

namespace LS.VisualScripting
{
    public class HideEntity : EntityUnit
    {
        [Serialize]
        [Inspectable, UnitHeaderInspectable]
        [TypeFilter(typeof(EntityBase))]
        public System.Type EntityLogicType { get; private set; } = null;
         
        [DoNotSerialize]
        [PortLabelHidden]
        public ValueInput EntityTypeId { get; set; }
        
        protected override void Definition()
        {
            base.Definition();
            EntityTypeId = ValueInput<int>(nameof(EntityTypeId), 0);
            Requirement(EntityTypeId, Input);
        }

        protected override ControlOutput In(Flow flow)
        {
            int entityId = flow.GetValue<int>(EntityTypeId);
            Target?.HideEntity(entityId);
            return base.In(flow);
        }
    }
}